Skip to content

Fix kHugeVal on AIX - #2850

Merged
sbc100 merged 1 commit into
WebAssembly:mainfrom
ProCern:huge-valf-fix
Sep 21, 2026
Merged

sbc100 merged 1 commit into
WebAssembly:mainfrom
ProCern:huge-valf-fix

Conversation

@TaylorRichberger

@TaylorRichberger TaylorRichberger commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

HUGE_VAL and HUGE_VALF on AIX are not constexpr.

Fixes: #2849

Comment thread src/literal.cc
@TaylorRichberger

Copy link
Copy Markdown
Contributor Author

@sbc100 I tried the const instead of constexpr change, and that fails with this error:

/tmp/selfgz120590983692/sard/deps/wabt/src/literal.cc:70:22: error: 'constexpr' needed for in-class initialization of static data member 'const float wabt::{anonymous}::FloatTraitsBase<float>::kHugeVal' of non-integral type [-fpermissive]
   70 |   static const float kHugeVal = HUGE_VALF;
      |                      ^~~~~~~~
In file included from /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/12/include/c++/cmath:45,
                 from /tmp/selfgz120590983692/sard/deps/wabt/src/literal.cc:30:
/tmp/selfgz120590983692/sard/deps/wabt/src/literal.cc:70:33: error: 'reinterpret_cast' is not a constant expression
   70 |   static const float kHugeVal = HUGE_VALF;
      |                                 ^~~~~~~~~
/tmp/selfgz120590983692/sard/deps/wabt/src/literal.cc:88:23: error: 'constexpr' needed for in-class initialization of static data member 'const double wabt::{anonymous}::FloatTraitsBase<double>::kHugeVal' of non-integral type [-fpermissive]
   88 |   static const double kHugeVal = HUGE_VAL;
      |                       ^~~~~~~~
/tmp/selfgz120590983692/sard/deps/wabt/src/literal.cc:88:34: error: 'reinterpret_cast' is not a constant expression
   88 |   static const double kHugeVal = HUGE_VAL;
      |                                  ^~~~~~~~

I could go with the numeric_limits in a guard for AIX, so there is no change for non-AIX platforms.

@TaylorRichberger

Copy link
Copy Markdown
Contributor Author

I've gone and made that change, so the rest of the platforms stay the same (though I'm now noticing that FloatTraitsBase<double>::kHugeVal was a float and not a double before, which seems like a mistake to me).

Comment thread src/literal.cc Outdated
HUGE_VAL and HUGE_VALF on AIX are not constexpr.
@sbc100
sbc100 enabled auto-merge (squash) September 21, 2026 19:43
@sbc100
sbc100 disabled auto-merge September 21, 2026 19:43
@sbc100
sbc100 enabled auto-merge (squash) September 21, 2026 19:43
@sbc100 sbc100 changed the title fix kHugeVal on AIX Fix kHugeVal on AIX Sep 21, 2026
@sbc100
sbc100 disabled auto-merge September 21, 2026 19:43
@sbc100
sbc100 enabled auto-merge (squash) September 21, 2026 19:43
@sbc100
sbc100 merged commit 02418f7 into WebAssembly:main Sep 21, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HUGE_VAL and HUGE_VALF are not constant expressions on AIX

2 participants